export function isWindow(object: any) {
  return Object.prototype.toString.call(object) === "[object Window]";
}

export function isBoolean(object: any) {
  return Object.prototype.toString.call(object) === "[object Boolean]";
}

export function isString(object: any) {
  return Object.prototype.toString.call(object) === "[object String]";
}

export function isNumber(object: any) {
  return Object.prototype.toString.call(object) === "[object Number]";
}

export function isNumberString(string: any) {
  return !isNaN(parseFloat(string)) && isFinite(string);
}

export function isUndefined(object: any) {
  return Object.prototype.toString.call(object) === "[object Undefined]";
}

export function isNull(object: any) {
  return Object.prototype.toString.call(object) === "[object Null]";
}

export function isArray(object: any) {
  return Object.prototype.toString.call(object) === "[object Array]";
}

export function isObject(object: any) {
  return Object.prototype.toString.call(object) === "[object Object]";
}

export function isVirtualDOM(object: any) {
  return (
    typeof object === "object" &&
    object !== null &&
    object.hasOwnProperty("key") &&
    object.hasOwnProperty("props") &&
    object.hasOwnProperty("ref") &&
    object.hasOwnProperty("type")
  );
}

export function isFunction(object: any) {
  return Object.prototype.toString.call(object) === "[object Function]";
}

export function isSymbol(object: any) {
  return Object.prototype.toString.call(object) === "[object Symbol]";
}

export function isRegExp(object: any) {
  return Object.prototype.toString.call(object) === "[object RegExp]";
}

export function isPromise(object: any) {
  return Object.prototype.toString.call(object) === "[object Promise]";
}

export function isMap(object: any) {
  return Object.prototype.toString.call(object) === "[object Map]";
}

export function isWeakMap(object: any) {
  return Object.prototype.toString.call(object) === "[object WeakMap]";
}

export function isSet(object: any) {
  return Object.prototype.toString.call(object) === "[object Set]";
}

export function isWeakSet(object: any) {
  return Object.prototype.toString.call(object) === "[object WeakSet]";
}

export function isXMLHttpRequest(object: any) {
  return Object.prototype.toString.call(object) === "[object XMLHttpRequest]";
}

export function isReflect(object: any) {
  return Object.prototype.toString.call(object) === "[object Reflect]";
}

export function isError(object: any) {
  return Object.prototype.toString.call(object) === "[object Error]";
}

export function isFormData(object: any) {
  return Object.prototype.toString.call(object) === "[object FormData]";
}

export function isKeyboardEvent(object: any) {
  return Object.prototype.toString.call(object) === "[object KeyboardEvent]";
}

export function isFile(object: any) {
  return Object.prototype.toString.call(object) === "[object File]";
}

export function isDate(object: any) {
  return Object.prototype.toString.call(object) === "[object Date]";
}

export function isAnyType(data: any, string: string) {
  if (isArray(data)) {
    data[Symbol.toStringTag] = string;
    return Object.prototype.toString.call(data) === `[object ${string}]`;
  }
  if (isString(data)) {
    const object: any = new String(data);
    object[Symbol.toStringTag] = string;
    return Object.prototype.toString.call(object) === `[object ${string}]`;
  }
  if (isNumber(data)) {
    const object: any = new Number(data);
    object[Symbol.toStringTag] = string;
    return Object.prototype.toString.call(object) === `[object ${string}]`;
  }
}

export function isEmptyObject(object: any) {
  return Reflect.ownKeys(object).length === 0;
}

export function isEmptyType(data: any) {
  const emptyType = ["", "undefined", "null", "NaN"];
  if (emptyType.includes(data + "")) return true;
  if (isObject(data) && isEmptyObject(data)) return true;
  return false;
}

export function isJSONParse(string: any) {
  try {
    JSON.parse(string);
  } catch (e) {
    return false;
  }
  return true;
}

export function isJSONString(string: string) {
  if (isString(string)) {
    try {
      let object = JSON.parse(string);
      return isObject(object) || isArray(object) || isString(object);
    } catch (e) {
      return false;
    }
  }
  return false;
}

export function isDocumentNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLDocument]";
}

export function isHtmlNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLHtmlElement]";
}

export function isHeadNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLHeadElement]";
}

export function isMetaNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLMetaElement]";
}

export function isTitleNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLTitleElement]";
}

export function isStyleNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLStyleElement]";
}

export function isLinkNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLLinkElement]";
}

export function isScriptNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLScriptElement]"
  );
}

export function isBodyNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLBodyElement]";
}

export function isDivNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLDivElement]";
}

export function isTableNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLTableElement]";
}

export function isTableSectionNode(object: any) {
  return (
    Object.prototype.toString.call(object) ===
    "[object HTMLTableSectionElement]"
  );
}

export function isTheadNode(object: any) {
  return isTableSectionNode(object) && object.nodeName === "THEAD";
}

export function isTbodyNode(object: any) {
  return isTableSectionNode(object) && object.nodeName === "TBODY";
}

export function isTfootNode(object: any) {
  return isTableSectionNode(object) && object.nodeName === "TFOOT";
}

export function isTrNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLTableRowElement]"
  );
}

export function isTableCellNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLTableCellElement]"
  );
}

export function isThNode(object: any) {
  return isTableCellNode(object) && object.nodeName === "TH";
}

export function isTdNode(object: any) {
  return isTableCellNode(object) && object.nodeName === "TD";
}

export function isColNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLTableColElement]"
  );
}

export function isCaptionNode(object: any) {
  return (
    Object.prototype.toString.call(object) ===
    "[object HTMLTableCaptionElement]"
  );
}

export function isPNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLParagraphElement]"
  );
}

export function isSpanNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLSpanElement]";
}

export function isImgNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLImageElement]";
}

export function isUlNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLUListElement]";
}

export function isLiNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLLIElement]";
}

export function isOlNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLOListElement]";
}

export function isFontNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLFontElement]";
}

export function isPreNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLPreElement]";
}

export function isBrNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLBRElement]";
}

export function isANode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLAnchorElement]"
  );
}

export function isMapNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLMapElement]";
}

export function isFormNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLFormElement]";
}

export function isInputNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLInputElement]";
}

export function isTextAreaNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLTextAreaElement]"
  );
}

export function isAreaNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLAreaElement]";
}

export function isMarqueeNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLMarqueeElement]"
  );
}

export function isAudioNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLAudioElement]";
}

export function isVideoNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLVideoElement]";
}

export function isSourceNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLSourceElement]"
  );
}

export function isSvgNode(object: any) {
  return Object.prototype.toString.call(object) === "[object SVGSVGElement]";
}

export function isSvgSymbolNode(object: any) {
  return Object.prototype.toString.call(object) === "[object SVGSymbolElement]";
}

export function isSvgImageNode(object: any) {
  return Object.prototype.toString.call(object) === "[object SVGImageElement]";
}

export function isH1Node(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLHeadingElement]" &&
    object.nodeName === "H1"
  );
}

export function isH2Node(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLHeadingElement]" &&
    object.nodeName === "H2"
  );
}

export function isH3Node(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLHeadingElement]" &&
    object.nodeName === "H3"
  );
}

export function isH4Node(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLHeadingElement]" &&
    object.nodeName === "H4"
  );
}

export function isH5Node(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLHeadingElement]" &&
    object.nodeName === "H5"
  );
}

export function isH6Node(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLHeadingElement]" &&
    object.nodeName === "H6"
  );
}

export function isLabelNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLLabelElement]";
}

export function isButtonNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLButtonElement]"
  );
}

export function isHrNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLHRElement]";
}

export function isIframeNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLIFrameElement]"
  );
}

export function isLegendNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLLegendElement]"
  );
}

export function isSelectNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLSelectElement]"
  );
}

export function isOptGroupNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLOptGroupElement]"
  );
}

export function isCanvasNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLCanvasElement]"
  );
}

export function isTextNode(object: any) {
  return Object.prototype.toString.call(object) === "[object Text]";
}

export function isBlob(object: any) {
  return Object.prototype.toString.call(object) === "[object Blob]";
}

export function isArrayBuffer(object: any) {
  return Object.prototype.toString.call(object) === "[object ArrayBuffer]";
}

export function isUint8Array(object: any) {
  return Object.prototype.toString.call(object) === "[object Uint8Array]";
}

export function isFileReader(object: any) {
  return Object.prototype.toString.call(object) === "[object FileReader]";
}

export function isHtmlRootNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLElement]";
}

export function isINode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "I";
}

export function isHeaderNode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "HEADER";
}

export function isNavNode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "NAV";
}

export function isAsideNode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "ASIDE";
}

export function isSummaryNode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "SUMMARY";
}

export function isSectionNode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "SECTION";
}

export function isFooterNode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "FOOTER";
}

export function isArticleNode(object: any) {
  return isHtmlRootNode(object) && object.nodeName === "ARTICLE";
}

export function isProgressNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLProgressElement]"
  );
}

export function isMeterNode(object: any) {
  return Object.prototype.toString.call(object) === "[object HTMLMeterElement]";
}

export function isDataListNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLDataListElement]"
  );
}

export function isOptionNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLOptionElement]"
  );
}

export function isDetailsNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLDetailsElement]"
  );
}

export function isOutputNode(object: any) {
  return (
    Object.prototype.toString.call(object) === "[object HTMLOutputElement]"
  );
}
